package com.zxyankh.raft.dto;

import com.alibaba.fastjson.JSON;

import java.util.HashMap;
import java.util.Map;

/**
 * @author ankh
 * @since 02.11.2017
 */
public class ConfigDto {
    private String configFilePath;
    private int serverId;
    private Map<Integer, ServerIpPortDto> serverIpPortMap;
    private long electionTimeout;

    public ConfigDto() {
        this.serverIpPortMap = new HashMap<>();
    }

    public ConfigDto(String configFilePath) {
        this.configFilePath = configFilePath;
        this.serverIpPortMap = new HashMap<>();
    }

    public String getConfigFilePath() {
        return configFilePath;
    }

    public void setConfigFilePath(String configFilePath) {
        this.configFilePath = configFilePath;
    }

    public int getServerId() {
        return serverId;
    }

    public void setServerId(int serverId) {
        this.serverId = serverId;
    }

    public Map<Integer, ServerIpPortDto> getServerIpPortMap() {
        return serverIpPortMap;
    }

    public void setServerIpPortMap(Map<Integer, ServerIpPortDto> serverIpPortMap) {
        this.serverIpPortMap = serverIpPortMap;
    }

    public long getElectionTimeout() {
        return electionTimeout;
    }

    public void setElectionTimeout(long electionTimeout) {
        this.electionTimeout = electionTimeout;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }
}
